﻿using LX.Core.Utils;
using LX.Core.Validation;
using S4Store.Domain;
using S4Store.Persistent;
using System.Linq;

namespace S4Store.Service.Valid.StoreValid
{
    public class Delete : ValidExpression<Store>
    {
        public S4StoreDataContext PersistentContext { get; set; }

        public override void ValidEntity(ValidationResult result, Store entity)
        {
            if(!Helper.ArrayIsEmpty(entity.Administrators.ToList()))
            {
                PushError(result, "删除店前请先删除属于此店的用户");
            }
        }
    }
}
